package com.zr.domain.bar.service;

import com.zr.domain.bar.entity.MarketDataEvent;
import org.apache.flink.api.common.serialization.AbstractDeserializationSchema;
import org.apache.flink.api.common.typeinfo.TypeInformation;

import java.io.IOException;

public class SampleDataRabbitMQSourceSerializer extends AbstractDeserializationSchema<MarketDataEvent> {
    @Override
    public MarketDataEvent deserialize(byte[] message) throws IOException {
        return MarketDataEvent.fromJson(new String(message));
    }

    @Override
    public boolean isEndOfStream(MarketDataEvent nextKline) {
        return false;
    }

    @Override
    public TypeInformation<MarketDataEvent> getProducedType() {
        return TypeInformation.of(MarketDataEvent.class);
    }
}

